package com.tuo51.evaluate.domain.evaluatingV2;

import com.starinside.wp.domain.Domain;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * 测评的详细记录，老师做过的选择
 */

@Data
@Entity
@Table(name = "tb_evaluate_record_answer", uniqueConstraints = {
        @UniqueConstraint(columnNames = {
                "questionId", "childrenId", "recordId"
        })
})
@EqualsAndHashCode(callSuper = true)
public class EvaluateV2RecordAnswer extends Domain{

    @Column(columnDefinition = "varchar(32) COMMENT '测评题目id' ")
    private String questionId;

    public static EvaluateV2RecordAnswer of(String questionId, String childrenId, String recordId, String dimensionScoreId, Integer month, String title, boolean checked, Integer score) {
        EvaluateV2RecordAnswer ret = new EvaluateV2RecordAnswer();
        ret.questionId = questionId;
        ret.childrenId = childrenId;
        ret.recordId = recordId;
        ret.dimensionScoreId = dimensionScoreId;
        ret.month = month;
        ret.title = title;
        ret.checked = checked;
        ret.score = score;
        return ret;
    }

    public void set(String dimensionScoreId, Integer month, String title, boolean checked, Integer score) {
        this.dimensionScoreId = dimensionScoreId;
        this.month = month;
        this.title = title;
        this.checked = checked;
        this.score = score;
    }

    @Column(columnDefinition = "varchar(32) COMMENT '测评小朋友id' ")
    private String childrenId;

    @Column(columnDefinition = "varchar(32) COMMENT '测评记录id' ")
    private String recordId;

    @Column(columnDefinition = "varchar(32) COMMENT '维度总分' ")
    private String dimensionScoreId;

    @Column(columnDefinition = "int default 0 COMMENT '测评归属月龄'")
    private Integer month = 0;

    @Column(columnDefinition = "varchar(50) COMMENT '测评题目标题' ")
    private String title;

    @Column(columnDefinition = "bit default 0 COMMENT '是否通过' ")
    private boolean checked = false;

    @Column(columnDefinition = "int COMMENT '得分' ")
    private Integer score;



}
